package com.lzy.cloud.goods.service.GoodsServiceImpl;

import com.lzy.cloud.goods.dtos.CarImageTextDto;
import com.lzy.cloud.goods.entity.CarImageText;
import com.lzy.cloud.goods.mapper.CarImageTextMapperExt;
import com.lzy.cloud.goods.service.CarImageTextService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by WIN7 on 2018/6/9.
 */
@Service
public class CarImageTextServiceImpl implements CarImageTextService{

    @Autowired
    CarImageTextMapperExt carImageTextMapperExt;

    @Override
    public Boolean add(CarImageTextDto dto) {
        return carImageTextMapperExt.insertSelective(DozerUtils.map(dto, CarImageText.class))>0;
    }

    @Override
    public Boolean delById(Long id) {
        return carImageTextMapperExt.deleteByPrimaryKey(id)>0;
    }

    @Override
    public Boolean update(CarImageTextDto dto) {
        return carImageTextMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto,CarImageText.class))>0;
    }

    @Override
    public List<CarImageTextDto> selectList(CarImageTextDto dto) {
        return carImageTextMapperExt.selectList(dto);
    }

    @Override
    public CarImageTextDto selectById(Long id) {
        return DozerUtils.map(carImageTextMapperExt.selectByPrimaryKey(id),CarImageTextDto.class);
    }
}
